/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.stat;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class d {
    private static final char[] a = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };

    public static String a(String paramString) {
        if ((paramString != null) && (paramString.length() > 0))
            try {
                byte[] arrayOfByte = paramString.getBytes("UTF-8");
                if ((arrayOfByte != null) && (arrayOfByte.length > 0)) {
                    MessageDigest localMessageDigest = MessageDigest.getInstance("MD5");
                    localMessageDigest.update(arrayOfByte);
                    arrayOfByte = localMessageDigest.digest();
                    paramString = a(arrayOfByte);
                }
            } catch (NoSuchAlgorithmException localNoSuchAlgorithmException) {
                localNoSuchAlgorithmException.printStackTrace();
            } catch (UnsupportedEncodingException localUnsupportedEncodingException) {
                localUnsupportedEncodingException.printStackTrace();
            } catch (Exception localException) {
                localException.printStackTrace();
            }
        return paramString;
    }

    private static String a(byte[] paramArrayOfByte) {
        StringBuilder localStringBuilder = new StringBuilder();
        for (int i = 0; i < paramArrayOfByte.length; ++i) {
            int j = paramArrayOfByte[i];
            localStringBuilder.append(a[((0xF0 & j) >> 4)]);
            localStringBuilder.append(a[(0xF & j)]);
        }
        return localStringBuilder.toString();
    }
}